package com.project.controller;


import com.project.bean.StatSellBean;

import com.project.service.IStatSellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

@RestController
@RequestMapping("stat")
public class StatSellController {
    @Autowired
    private IStatSellService statSellService;

    @RequestMapping("findByType")
    public List<StatSellBean> findByType(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate, @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate) {
        return statSellService.findByType(startDate, endDate);
    }

    @RequestMapping("findByGoods")
    public List<StatSellBean> findByGoods(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate, @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate) {
        return statSellService.findByGoods(startDate, endDate);
    }
}
